/*
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 *
 * Copyright (c) 2013-2014 jfinal app. jfapp Group.
 */

define(['adminapp'], function ($app) {
    $app.navactive('game_awards');

    var arr = ["", "游戏奖励"]

    var action_tpl = Handlebars.compile($(g.actiontpl).html());
    var state_tpl = Handlebars.compile($(g.statetpl).html());

    $app.listtable({
        'sAjaxSource' : g.ctx + "admin/game/awards/list",
        'aoColumns'   : [
            $app.checkall,
            $app.autono,
            {'mDataProp': 'name' },
            {'mDataProp': 'giftName' },
            {'mDataProp': 'state' },
            {'mDataProp': 'size' },
            {'mDataProp': 'type' },
            {'mDataProp': 'integrel' }
        ],
        'aoColumnDefs': [
            {
                'aTargets': [4],
                'mData'   : null,
                'mRender' : function (data, type, full) {
                    return state_tpl(full);
                }
            },
            {
                'aTargets': [6],
                'mData'   : null,
                'mRender' : function (data, type, full) {
                    return arr[full['type']];
                }
            },
            {
                'aTargets': [8],
                'mData'   : null,
                'mRender' : function (data, type, full) {
                    return action_tpl(full);
                }
            }
        ]
    }, 'data-list')
});

